package day6;

public class Demo4 {

    abstract static class Employee{
        private int id;
        private String name;
        private String sex;
        private int salary;

        public int getSalary() {
            return salary;
        }

        public void setSalary(int salary) {
            this.salary = salary;
        }

        abstract void doWork();
    }

    static class Accountant extends Employee{

        private int salary = 4500;

        public int getSalary() {
            return salary;
        }

        public void setSalary(int salary) {
            this.salary = salary;
        }

        @Override
        void doWork() {
            System.out.println("整理报表");
        }
    }

    static class Programmer extends Employee{
        private int salary = 10000;

        public int getSalary() {
            return salary;
        }

        public void setSalary(int salary) {
            this.salary = salary;
        }

        @Override
        void doWork() {
            System.out.println("写程序");
        }
    }

    public static void main(String[] args) {
        Employee Acc = new Accountant();
        Employee Pro = new Programmer();

        Acc.doWork();
        System.out.println("会计的工资为:" + Acc.getSalary());
        Pro.doWork();
        System.out.println("程序员的工资为:" + Pro.getSalary());

    }
}
